package com.xxxx.seckill.rabbitmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 消息发送者
 *
 * @Author: Kong
 * @DateTime: 2022/4/26 22:45
 * @Description: TODO
 */
@Slf4j
@Service
public class MQSender {

//    @Autowired
//    private RabbitTemplate rabbitTemplate;
//    public void send(Object msg) {
//        log.info("发送消息："+msg);
//        rabbitTemplate.convertAndSend("queue", msg);
//    }


    //发送秒杀信息
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendsecKillMessage(String message) {
        log.info("发送消息：" + message);
        rabbitTemplate.convertAndSend("seckillExchange", "seckill.msg", message);
    }
}
